package com.example.springalibabacloudfeignauth.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.springalibabacloudfeignauth.feign.ProviderFeign;
import com.example.springalibabacloudfeignauth.feign.TestFeign;
import com.example.springalibabacloudfeignauth.utils.Results;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname FeignController
 * @Description TODO
 * @Date 2022/5/14 11:33
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@RestController
@Slf4j
@RequestMapping("feign")
public class FeignController {



    @Autowired
    private TestFeign testFeign;

    @Autowired
    private ProviderFeign providerFeign;

    @GetMapping("v1")
    public JSONObject v1Controller(){
        log.info("走到v1==================>");
       String success=testFeign.getString();
       return Results.success(success);
    }

    @GetMapping("v2")
    public JSONObject v2Controller(){
         JSONObject object=providerFeign.proApi();
        return object;
    }

    @GetMapping("v3")
    public JSONObject v3Controller(){
        return providerFeign.proV3();
    }
}
